//求最大公约数和最小公倍数
import java.sql.SQLOutput;
import java.util.Scanner;
public class test_01 {
    public static void main(String[] args) {
        System.out.println("请输入两个整数");
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int d = zdgys(a,b);//最大公约数
        int x = zsgbs(a,b);//最小公倍数
        System.out.println("最大公约数："+d);
        System.out.println("最小公倍数："+x);
    }

    public static int zdgys(int a,int b) {
        int min = a < b? a:b;
        for(int i = min;i>=1;i--){
            if(a % i ==0 && b % i ==0){
                return i;
            }
        }
        return 0;
    }

    public static int zsgbs(int a,int b) {
        int max = a > b? a:b;
        for(int i =max; ; i+=max){
            if(i % a ==0 && i % b ==0){
                return i;
            }
        }
    }

}
